package com.mybatisplus.demo.controller;

//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.mybatisplus.demo.entity.TStudent;
import com.mybatisplus.demo.mapper.TStudentMapper;
import com.mybatisplus.demo.service.TStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
public class TestController {
    @Resource
    private TStudentMapper userMapper;
    @Autowired
    TStudentService UserService;
    @ResponseBody
    @RequestMapping("/getstudent")
    public TStudent getstudent() {
        TStudent student = null;
        try {
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("name", "张三");
            student = UserService.selectUserByMap(map);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return student;


    }
    @ResponseBody
    @RequestMapping("/insert")
    public TStudent insert() {
        TStudent student = null;
        try {
            TStudent user = new TStudent();
            user.setSname("哈哈");
            user.setSex("0");

            int insert = userMapper.insert(user);
            System.out.println("影像记录数："+insert);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return student;


    }


}
